<?php
/**
 * Enter description here...
 *	
 * STATUS_DISABLE 0 
 * STATUS_ABLE 1 
 */
class Sysconfig extends CActiveRecord {
	public static function model($className = __CLASS__) {
		return parent::model ( $className );
	}
	
	public function tableName() {
		return '{{sysconfig}}';
	}
	
	public function rules() {
		return array (
			
			array (
				
				'template', 
				'required', 
				'message' => '不能为空' 
			), 
			array (
				
				'webname,url,title,keywords,description,record,type,systemplate,webtemplate', 
				'safe' 
			) 
		);
	}
	
	public function relations() {
		return array ();
	}
	
	public function attributeLabels() {
		return array (
			
			'id' => 'id', 
			'webname' => 'webname', 
			'url' => 'url', 
			'title' => 'title', 
			'keywords' => 'keywords', 
			'description' => 'description', 
			'record' => 'record', 
			'type' => 'type', 
			'systemplate' => 'systemplate', 
			'webtemplate' => 'webtemplate' 
		);
	}
	public function getConfigByType($type = "sysconfig") {
		$rows = $this->find ( array (
			
			"condition" => "type='$type'" 
		) );
		return CommonFunc::YiiobjectToArray ( $rows, "one" );
	}
}
?>
